package com.masterviame.Authc.pojo;

import java.util.List;

/**
 * Created by mastervictory on 2017/12/13.
 */
public class Role {

    private  int roleid;
    private String role;
    private String description;
    private boolean available;
    private String permissionsCode;
    private List<Permission> permissions;

    public int getRoleid() {
        return roleid;
    }

    public void setRoleid(int roleid) {
        this.roleid = roleid;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isAvailable() {
        return available;
    }

    public void setAvailable(boolean available) {
        this.available = available;
    }

    public String getPermissionsCode() {
        return permissionsCode;
    }

    public void setPermissionsCode(String permissionsCode) {
        this.permissionsCode = permissionsCode;
    }

    public List<Permission> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<Permission> permissions) {
        this.permissions = permissions;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Role role1 = (Role) o;

        if (getRoleid() != role1.getRoleid()) return false;
        if (isAvailable() != role1.isAvailable()) return false;
        if (getRole() != null ? !getRole().equals(role1.getRole()) : role1.getRole() != null) return false;
        if (getDescription() != null ? !getDescription().equals(role1.getDescription()) : role1.getDescription() != null)
            return false;
        if (getPermissionsCode() != null ? !getPermissionsCode().equals(role1.getPermissionsCode()) : role1.getPermissionsCode() != null)
            return false;
        return getPermissions() != null ? getPermissions().equals(role1.getPermissions()) : role1.getPermissions() == null;
    }

    @Override
    public int hashCode() {
        int result = getRoleid();
        result = 31 * result + (getRole() != null ? getRole().hashCode() : 0);
        result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0);
        result = 31 * result + (isAvailable() ? 1 : 0);
        result = 31 * result + (getPermissionsCode() != null ? getPermissionsCode().hashCode() : 0);
        result = 31 * result + (getPermissions() != null ? getPermissions().hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Role{" +
                "roleid=" + roleid +
                ", role='" + role + '\'' +
                ", description='" + description + '\'' +
                ", available=" + available +
                ", permissionsCode='" + permissionsCode + '\'' +
                ", permissions=" + permissions +
                '}';
    }
}
